// Simcenter STAR-CCM+ macro: DishcargecellpowerA1.java
// Written by Simcenter STAR-CCM+ 18.02.008
package macro;

import java.util.*;

import star.common.*;
import star.base.neo.*;

public class Creat_DishcargecellpowerA1 extends StarMacro {


    public void execute() {
        for (int i = 2; i <= 24; i++) {
            execute0(i);
        }
    }

    private void execute0(int i) {
                                                            String definition = generatepowerDefinition(i);

    Simulation simulation_0 =       getActiveSimulation();

    UserFieldFunction userFieldFunction_57 =       simulation_0.getFieldFunctionManager().createFieldFunction();

    UserFieldFunction userFieldFunction_2 =       ((UserFieldFunction) simulation_0.getFieldFunctionManager().getFunction("discharge cellpower A1"));

    userFieldFunction_57.copyProperties(userFieldFunction_2);

    userFieldFunction_57.setPresentationName("discharge cellpower A1 \u526F\u672C");

    userFieldFunction_57.setPresentationName("discharge cellpower A"+i);

    userFieldFunction_57.setFunctionName("discharge cellpower A"+i);

    Units units_3 =       simulation_0.getUnitsManager().getPreferredUnits(Dimensions.Builder().current(1).build());

    Units units_4 =       simulation_0.getUnitsManager().getPreferredUnits(Dimensions.Builder().electricalResistance(1).build());



    userFieldFunction_57.setDefinition(definition);
  }
                                     private String generatepowerDefinition(int i) {
                                                                                    StringBuilder result = new StringBuilder(); 
                                                                                    result.append("${current}*${current}*${resistance A")
                                                                                          .append(i)
                                                                                          .append("}/1000")
                                                                                          .append("\n"); // 换行

                                                                                    return result.toString();
                                                                                    
                                                                                    }

}
